<?php

namespace App\Http\Controllers\Admin;

use App\Http\Controllers\AdminController as Controller;
use Illuminate\Support\Facades\DB;
use Illuminate\Http\Request; 
use App\Model\{Admin,User,Config,Cat,Usertree}; 
use Illuminate\Support\Facades\Crypt;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\Redis;
use App\Libraries\vendor\Sms;
use GeoIp2\Database\Reader;
use App\Libraries\vendor\SphinxClient;

/**
 * #@menu_cat 合伙人
 * @icon cog
 * @sort 30
 */
class UsertreeController extends Controller
{
	public function __invoke(){
        return $this->index(func_get_args());
    }

    /**
     * @menu 合伙人列表
     */
    public function index(){
    	$list = DB::table('user_tree')->where('user_level','2');
    	$this->_search($list, $search);
        $this->_order($list);
        $list = $list->paginate(20);
        Usertree::separat_format($list);
        return view('Admin.Usertree.index')->with([
            'list' => $list,
            '_search'=>$search,
        ]);
    }


    /**
     * @name 查看合伙人子孙
     */
    public function nodes($id){
    	$list = Usertree::nodes($id);
    	return view('Admin.Usertree.nodes')->with([
            'list' => $list,
        ]);
    }
}